package com.jin.spirng_boot_learn.rbtree;

public class Node {

    public static final Integer BLACK = 0;
    public static final Integer RED = 1;


    private Integer color = Node.BLACK;

    private Node left;

    private Node right;

    private Integer value;

    private Node father;

    public Node getFather() {
        return father;
    }

    public void setFather(Node father) {
        this.father = father;
    }


    public Integer getColor() {
        return color;
    }

    public void setColor(Integer color) {
        this.color = color;
    }

    public Node getLeft() {
        return left;
    }

    public void setLeft(Node left) {
        this.left = left;
    }

    public Node getRight() {
        return right;
    }

    public void setRight(Node right) {
        this.right = right;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public Node(Integer color, Node left, Node right, Integer value) {
        if (color != Node.BLACK && color != Node.RED) {
            throw new IllegalArgumentException("invalid color:" + color);
        }
        this.color = color;
        this.left = left;
        this.right = right;
        this.value = value;
    }

}
